<script>
  import $ from 'dfish-widget'
  import Method from '../Method.vue'

  export default {
    mixins: [Method],
    data() {
      return {
        name: '$(target)',
        remark: '获取target所在的widget组件实例',
        attrs: [{
          name: 'target',
          remark: '来源目标',
          type: 'Component / HTMLElement / Event',
        }],
        examples: [{
          remark: '点击"测试"按钮，获取按钮的属性',
          type: 'html',
          code: `
            <template>
              <w-view :data="{id:'001'}">
                <w-button @click="test" text="测试"></w-button>
              </w-view>
            </template>
            <${'script'}>
              import $ from 'dfish-widget'
              export default {
                methods: {
                  test(e) {
                    console.log($(e).text) //打印 "测试"
                  }
                }
              }
            </${'script'}>
            `
        }]
      }
    }
  }
</script>
